<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <title>APP</title>
    <link rel="stylesheet" type="text/css" href="../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="./css/person_center_frame.css" />
</head>


<body>

<div id="list"></div>



</body>

<script id="myName" type="text/x-dot-template">

<div style="text-align:center;margin:1rem;">
    <img src="{{? it}}{{=it}}{{??}}./img/user.jpg{{?}}" style="display:inline-block;width:6rem;height:6rem" onclick="C_imgUpload('callBack')" id="img">
    <p>修改头像</p>
</div>


<ul class="aui-list aui-form-list">
    <li class="aui-list-item" style="padding:0.8rem;">
        <div class="aui-list-item-inner">
            <div class="aui-list-item-label">
                您的昵称：
            </div>
            <div class="aui-list-item-input">
                <input type="text" placeholder="请填写您的昵称" id="nickname">
            </div>
        </div>
    </li>


    <li class="aui-list-item" style="padding:0.8rem;">
        <div class="aui-list-item-inner">
            <div class="aui-list-item-label">
                性别：
            </div>
            <div class="aui-list-item-input">
                <label style="margin-right:1rem"><input class="aui-radio" type="radio" name="demo1" checked value="2">男</label>
                <label style="margin-right:1rem"><input class="aui-radio" type="radio" name="demo1" value="1">女</label>
                <label style="margin-right:1rem"><input class="aui-radio" type="radio" name="demo1" value="0">保密</label>
            </div>
        </div>
    </li>


</ul>

<div class="" style="padding:0 1rem;margin:1.5rem 0;border:none;">
    <div tapmode onclick="fnSubmitData()" ; style="border-radius:0.6rem;border:1px solid #ccc;text-align:center;line-height:2.4rem;background:#ff4285;color:#fff;width:100%；">保存修改</div>
</div>
</script>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="./conf/config.js"></script>
<script type="text/javascript" src="./js/common.js"></script>
<script type="text/javascript" src="../script/doT.min.js"></script>
<script type="text/javascript">
    apiready = function() {

        fnGetList(api.pageParam.phone);
        initRefreshCommon('fnGetList(api.pageParam.avatar)');
    };

    function fnSubmitData() {

        var sex = $('input:radio[name="demo1"]:checked').val();

        var nickname = $("#nickname").val();
        var head_img = $("#img").attr("src");

        fnGetDataCommon("callBack1", "index.php?m=api&c=appnew&a=set_user_nickname", "post", {
            nickname: nickname,
            sex: sex,
            head_img: head_img
        });
    }

    function callBack1Res(ret) {
        api.toast({
            msg: ret.msg,
            duration: 2000,
            location: 'middle'
        });
        fncloseWinCommon("my_home", "my_home_frame", 'fnGetDataCommon("MyHome","index.php?m=api&c=appnew&a=get_userinfo","get")');
        fncloseWinCommon("person_center", "person_center_frame", '  fnGetUserInfo()');
    }

    function fnGetList(pageParam_) {


          var interText = doT.template($("#myName").text());
          $("#list").html(interText(pageParam_));


        // if (pageParam_) {
        //     $("#img").attr("src", pageParam_);
        // } else {
        //     $("#img").attr("src", "./img/user.jpg");
        // }

        api.refreshHeaderLoadDone();
    }

    function callBackImg(ret) {

        $("#img").attr("src", ret.msg.src);
    }
</script>

</html>
